/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package aviacad;

import com.sun.xml.internal.ws.util.StringUtils;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Юминова Анна
 */
@Entity
@Table(name = "schedule")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Schedule.findAll", query = "SELECT s FROM Schedule s"),
    @NamedQuery(name = "Schedule.findByFlightNumber", query = "SELECT s FROM Schedule s WHERE s.flightNumber = :flightNumber"),
    @NamedQuery(name = "Schedule.findByCityFrom", query = "SELECT s FROM Schedule s WHERE s.cityFrom = :cityFrom"),
    @NamedQuery(name = "Schedule.findByCityTo", query = "SELECT s FROM Schedule s WHERE s.cityTo = :cityTo"),
    @NamedQuery(name = "Schedule.findByDeparture", query = "SELECT s FROM Schedule s WHERE s.departure = :departure"),
    @NamedQuery(name = "Schedule.findByArrival", query = "SELECT s FROM Schedule s WHERE s.arrival = :arrival"),
    @NamedQuery(name = "Schedule.findByAircraft", query = "SELECT s FROM Schedule s WHERE s.aircraft = :aircraft"),
    @NamedQuery(name = "Schedule.findByFlightTime", query = "SELECT s FROM Schedule s WHERE s.flightTime = :flightTime")})
public class Schedule implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "flight_number")
    private String flightNumber;
    @Basic(optional = false)
    @Column(name = "city_from")
    private String cityFrom;
    @Basic(optional = false)
    @Column(name = "city_to")
    private String cityTo;
    @Basic(optional = false)
    @Column(name = "departure")
    @Temporal(TemporalType.TIMESTAMP)
    private Date departure;
    @Basic(optional = false)
    @Column(name = "arrival")
    @Temporal(TemporalType.TIMESTAMP)
    private Date arrival;
    @Basic(optional = false)
    @Column(name = "aircraft")
    private String aircraft;
    @Basic(optional = false)
    @Column(name = "flight_time")
    @Temporal(TemporalType.TIME)
    private Date flightTime;

    public Schedule() {
    }

    public Schedule(String flightNumber) {
        this.flightNumber = flightNumber;
    }

    public Schedule(String flightNumber, String cityFrom, String cityTo, Date departure, Date arrival, String aircraft, Date flightTime) {
        this.flightNumber = flightNumber;
        this.cityFrom = cityFrom;
        this.cityTo = cityTo;
        this.departure = departure;
        this.arrival = arrival;
        this.aircraft = aircraft;
        this.flightTime = flightTime;
    }

    public String getFlightNumber() {
        return flightNumber;
    }

    public void setFlightNumber(String flightNumber) {
        this.flightNumber = flightNumber;
    }

    public String getCityFrom() {
        return cityFrom;
    }

    public void setCityFrom(String cityFrom) {
        this.cityFrom = cityFrom;
    }

    public String getCityTo() {
        return cityTo;
    }

    public void setCityTo(String cityTo) {
        this.cityTo = cityTo;
    }

    public Date getDeparture() {
        return departure;
    }

    public void setDeparture(Date departure) {
        this.departure = departure;
    }

    public Date getArrival() {
        return arrival;
    }

    public void setArrival(Date arrival) {
        this.arrival = arrival;
    }

    public String getAircraft() {
        return aircraft;
    }

    public void setAircraft(String aircraft) {
        this.aircraft = aircraft;
    }

    public Date getFlightTime() {
        return flightTime;
    }

    public void setFlightTime(Date flightTime) {
        this.flightTime = flightTime;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (flightNumber != null ? flightNumber.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Schedule)) {
            return false;
        }
        Schedule other = (Schedule) object;
        if ((this.flightNumber == null && other.flightNumber != null) || (this.flightNumber != null && !this.flightNumber.equals(other.flightNumber))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "aviacad.Schedule[ flightNumber=" + flightNumber + " ]";
    }
       
    
   
}
